
function openLayer(url, title) {

  $.get(url, function (res) {
    layer.open({
      type: 1
      , title: title
      , area: ["700px", "400px"]
      , content: res
      , success: function (){

        layui.form.render();
      }
    });
  });

}

function mySubmit(filter,type){
  //监听提交
  layui.form.on('submit('+filter+')', function (data) {
    console.log("data:"+data.form.action);
    // layer.msg(JSON.stringify(data.field));
    $.ajax({
      url: data.form.action
      , async: false //是否异步
      , type: type
      , contentType: 'application/json;charset=utf8'
      , data: JSON.stringify(data.field)
      , success: function (res) {
        if (res.code == 0) {
          layer.closeAll();
          query();
        } else {
          layer.alert(res.msg);
        }
      }
    })

    return false;
  });
}

function myDelete(url){
  $.ajax({
    url: url
    , async: false //是否异步
    , type: 'DELETE'
    , success: function (res) {
      if (res.code == 0) {
        query();
      } else {
        layer.alert(res.msg);
      }
    }
  })
}